<template>
  <view class="content">
    <!--  url指定完整路径  -->
    <navigator class="dhcc_btn dhcc_margin" url="/pages/home/home">1,点击跳转‘数据绑定的学习’</navigator>
    <navigator class="dhcc_btn dhcc_margin" url="/pages/navigator/navogator">2,点击跳转‘导航跳转的学习’</navigator>
    <navigator class="dhcc_btn dhcc_margin" url="/pages/uni-style/uni-style">3,点击跳转‘样式的学习’</navigator>
    <navigator class="dhcc_btn dhcc_margin" url="/pages/list/list">4,点击跳转‘列表页的学习’</navigator>
    <button type="warn" size="mini" @click="clickH5ToPDA">H5->PDA医嘱执行</button>
    <button type="warn" size="mini" @click="clickH5ToPDARecord">H5->PDA护理病历（国产化）</button>
    <view>自定义组件和传值</view>
    <!--  ：title 是组件的属性，对应组件方法：props: ['title'], @myEven是事件，getNum是调用对应方法-->
    <test v-if="flag" :title="title" @myEven="getNum"></test>
    <button type="primary" @click="checkTest">切换test组件</button>
    这是子组件传递过来的数据{{ num }}
    <test-a></test-a>
    <test-b></test-b>
    <uni-calendar
        :insert="true"
        :lunar="true"
        :start-date="'2019-3-2'"
        :end-date="'2019-5-20'"
        @change="change">
    </uni-calendar>
  </view>
</template>

<script>
import test from '../../components/test.vue'
import testA from '../../components/a.vue'
import testB from '../../components/b.vue'
// @是根目录，绝对路径；或者../../相对路径
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'

export default {
  data() {
    return {
      title: 'Hello',
      num: 0,
      flag: true
    }
  },
  onLoad(options) {
    console.log('页面加载了', options)
  },
  onShow() {
    console.log('页面显示了')
  },
  onReady() {
    console.log('页面初次渲染完成了')
  },
  onHide() {
    console.log('页面隐藏了')
  },
  methods: {
    clickH5ToPDARecord() {
      // 国产化-新产品组跳转 护理病历
      var Intent = plus.android.importClass("android.content.Intent");
      var intent = new Intent();
      // intent.setAction("com.dhcc.nursepro.universal") //对应包名加.universal
      intent.setAction("com.dhcc.res.universal") //对应包名加.universal
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      intent.putExtra("__RootFragmentClassName__", "com.dhcc.module.emr.PatNurRecordFragment");
      var Bundle = plus.android.importClass("android.os.Bundle");
      var bundle = new Bundle();
      //-----------start  传这几个参数(国产化)--------
      bundle.putString("http", "http");
      bundle.putString("accessToken", "ZlHw48fOP03z6FtzrAgW5TbE9V166gdXKMwfg0Svdhofc0PPTAVgQ3Xq-82PCj4dhvhBGFMvLdDkl865khbkUOGN5kGPL0ONOrO56slrP2bzFcwCNJhyirKqxDWb7Ixi");
      bundle.putString("ip", "81.70.230.87:8091");
      bundle.putString("hospitalId", "1");
      // bundle.putString("groupId", "25");
      bundle.putString("wardId", "14");
      bundle.putString("locId", "4372f7eb46f262d846522eefee2bc3d9");
      bundle.putString("userId", "8a2288415c724d018453c71609fc9287");
      bundle.putString("userCode", "hs01");
      //--------------M后台用的-----------------
      // bundle.putString("http", "https");
      // bundle.putString("ip", "114.242.246.235:1443");
      // bundle.putString("path", "/imedical/webservice");
      // bundle.putString("hospitalId", "2");
      // bundle.putString("groupId", "25");
      // bundle.putString("wardId", "3");
      // bundle.putString("locId", "8");
      // bundle.putString("userId", "20665");
      // bundle.putString("userCode", "hs01");
      // bundle.putString("webServiceUserName",  "dhwebservice");
      // bundle.putString("webServicePassword", "3ua4B!9Q");
      //------------end  ----------
      intent.putExtra("__Args__", bundle);
      plus.android.runtimeMainActivity().startActivity(intent);
    },
    clickH5ToPDA() {
      // 手麻跳转护士执行
      var Intent = plus.android.importClass("android.content.Intent");
      var intent = new Intent();
      intent.setAction("com.dhcc.nursepro.universal")
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      intent.putExtra("__RootFragmentClassName__", "com.dhcc.nursepro.workarea.orderexecute.OrderExecuteFragment");
      var Bundle = plus.android.importClass("android.os.Bundle");
      var bundle = new Bundle();
      //-----------start  传这几个参数--------
      bundle.putString("http", "https");
      bundle.putString("ip", "82.157.186.213:1443");
      bundle.putString("path", "/imedical/webservice");
      bundle.putString("hospitalId", "2");
      bundle.putString("groupId", "23");
      bundle.putString("wardId", "3");
      bundle.putString("locId", "8");
      bundle.putString("userId", "18885");
      bundle.putString("userCode", "666");
      bundle.putString("regNo", "0000000598");
      bundle.putString("regNo", "REG0000000489");
      //------------end  ----------
      intent.putExtra("__Args__", bundle);
      plus.android.runtimeMainActivity().startActivity(intent);
    },
    checkTest() {
      this.flag = !this.flag
    },
    getNum(num) {
      console.log(num)
      this.num = num
    },
    change(e) {
      console.log('出发了change', e)
    }
  },
  // 添加组件，key和value相同可省略；驼峰命名大写，中间变-
  components: {
    test,
    "test-a": testA,
    "test-b": testB,
    uniCalendar
  }
}
</script>

<style>
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  height: 200rpx;
  width: 200rpx;
  margin-top: 200rpx;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 50rpx;
}

.text-area {
  display: flex;
  justify-content: center;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
}
</style>
